<?php
namespace Application;
$explode = explode("/", $_SERVER ['REQUEST_URI']);
$controllers = array(
        1=>'perfil',
        2=>'funcao-atividade'
        );
$submodule="";
if(array_intersect($explode,$controllers))
{
    $submodule = array_values(array_intersect($explode,$controllers))[0];	
}
return array(
        'controllers' => array(
                'invokables' => array(
                        'index' => 'Application\Controller\IndexController',
                        'perfil' => 'Application\Controller\Perfil\PerfilController',
                        'funcao-atividade' => 'Application\Controller\FuncaoAtividade\FuncaoAtividadeController'
                )
        ),
        'router' => array(
                'routes' => array(
                        'home' => array(
                                'type' => 'Literal',
                                'options' => array(
                                        'route' => '/',
                                        'defaults' => array(
                                                'controller' => 'index',
                                                'action' => 'index'
                                        )
                                )
                        ),
                        'logout' => array(
                                'type' => 'Literal',
                                'options' => array(
                                        'route' => '/logout',
                                        'defaults' => array(
                                                'action' => 'logout',
                                                'controller' => 'index'
                                        )
                                )
                        ),
                        'loading-menu' => array(
                                'type' => 'Literal',
                                'options' => array(
                                        'route' => '/loading-menu',
                                        'defaults' => array(
                                                'action' => 'loadingMenu',
                                                'controller' => 'index'
                                        )
                                )
                        ),
                        'admin-perfil' => array(
                                'type' => 'Segment',
                                'options' => array(
                                        'route' => '/[:module]/[:submodule][/:action][/id/:id]',
//                                         'route'    => '/[:module[/:submodule[/:action]]][/:id]',
                                        'constraints' => array(
                                                'module' => '[a-zA-Z][a-zA-Z0-9_-]*',
                                                'submodule' => '[a-zA-Z][a-zA-Z0-9_-]*',
                                                'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                                                'id' => '[0-9]+'
                                        ),
                                        'defaults' => array(
                                                'controller' => $submodule
                                        )
                                )
                        ),
                       
                )
        ),
        
        'route_layouts' => array(
                'home' => 'layout/login',
                'admin-perfil' => 'layout/layout'
        ),
        'view_manager' => array(
                'display_not_found_reason' => true,
                'display_exceptions' => true,
                'doctype' => 'HTML5',
                'not_found_template' => 'error/404',
                'exception_template' => 'error/index',
                'template_map' => array(
                        'error/404' => __DIR__ . '/../view/error/404.phtml',
                        'layout/layout' => __DIR__ .
                                 '/../view/layout/layout.phtml',
                                'layout/login' => __DIR__ .
                                 '/../view/layout/login.phtml',
                                'error/index' => __DIR__ .
                                 '/../view/error/index.phtml',
                                'layout/topo' => __DIR__ .
                                 '/../view/layout/topo.phtml',
                                'layout/menu-lateral' => __DIR__ .
                                 '/../view/layout/menu-lateral.phtml',
                                'layout/menu-modal' => __DIR__ .
                                 '/../view/layout/modal.phtml'
                ),
                'template_path_stack' => array(
                        __DIR__ . '/../view'
                )
        ),
        'service_manager' => array(
                'factories' => array(
                        'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory'
                // 'navigation' =>
                // 'Zend\Navigation\Service\DefaultNavigationFactory',
                                )
        ),
        'translator' => array(
                'locale' => 'en_US',
                'translation_patterns' => array(
                        array(
                                'type' => 'gettext',
                                'base_dir' => __DIR__ . '/../language',
                                'pattern' => '%s.mo'
                        )
                )
        ),
        'doctrine' => array(
                'driver' => array(
                        __NAMESPACE__ . '_driver' => array(
                                'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
                                'cache' => 'array',
                                'paths' => array(
                                        __DIR__ . '/../src/' . __NAMESPACE__ .
                                         '/Entity'
                                )
                        ),
                        'orm_default' => array(
                                'drivers' => array(
                                        __NAMESPACE__ . '\Entity' => __NAMESPACE__ .
                                         '_driver'
                                )
                        )
                )
        )
);